package com.hu.ta.assignment5.util;

/**
 * 
 */

import java.util.Observable;
import java.util.Properties;

/**
 * Class for handling the configuration of the application
 * 
 * @author cage@g.com
 */
public class ConfigurationUtils extends Observable {

	private static ConfigurationUtils instance;

	protected final Properties configurationSettings;

	private ConfigurationUtils() {
		super();
		configurationSettings = new Properties();
	}

	public synchronized static ConfigurationUtils getInstance() {
		if (null == instance) {
			instance = new ConfigurationUtils();
		}
		return instance;
	}

	private String getProperty(ConfigEnum config) {
		return configurationSettings.getProperty(config.getConfigProperty(),
				config.getDefaultValue());
	}

	public String getInputFolder() {
		return getProperty(ConfigEnum.INPUT_FOLDER);
	}

	public String getTrainedDataFile() {
		return getProperty(ConfigEnum.TRAINED_DATA);
	}

	public boolean IsLearning() {
		return getProperty(ConfigEnum.LEARN_MODE).equals("true");
	}

	public String getOutputFolder() {
		return getProperty(ConfigEnum.OUTPUT_FOLDER);
	}
}
